//
//  NSString+RAExtension.m
//  RayoSmartBleKey
//
//  Created by Piccolo on 08/03/2018.
//  Copyright © 2018 Piccolo. All rights reserved.
//

#import "NSString+RAExtension.h"

@implementation NSString (RAExtension)

- (NSString *)ra_toLower {
    
    NSString *str = self;
    for (NSInteger i = 0; i < str.length; i++) {
        if ([str characterAtIndex:i] >= 'A' & [str characterAtIndex:i] <= 'Z') {
            char temp = [str characterAtIndex:i]+32;
            NSRange range = NSMakeRange(i, 1);
            str = [str stringByReplacingCharactersInRange:range withString:[NSString stringWithFormat:@"%c",temp]];
        }
    }
    return str;
}

- (NSString *)ra_toUpper {
    
    NSString *str = self;
    for (NSInteger i = 0; i < str.length; i++) {
        if ([str characterAtIndex:i] >= 'a' & [str characterAtIndex:i] <= 'z') {
            char temp = [str characterAtIndex:i] - 32;
            NSRange range = NSMakeRange(i, 1);
            str = [str stringByReplacingCharactersInRange:range withString:[NSString stringWithFormat:@"%c",temp]];
        }
    }
    return str;
}

@end
